perm filename USWP[S1,ALS] blob
sn#427529 filedate 1979-03-22 generic text, type C, neo UTF8
COMMENT ā VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 procedure DUPLICATE (D1 , D2 : STKINX D2TYP : OPNDTYPE )
C00005 ENDMK
Cā;
procedure DUPLICATE (D1 , D2 : STKINX; D2TYP : OPNDTYPE );
(* Basic procedure used by UDUP and USWP to duplicate a DATUM from D2 to D1*)
begin
STK[D1].CODESTART := STK[D2].CODESTART;
if STK[D1].CODESTART <> nil then ASSERTFAIL ('CODST_NOTNIL');
STK[D1].DTYPE := STK[D2].DTYPE ;
if D2TYP = TYPB then
begin
STK[D1].BREPRES := STK[D2].BREPRES;
STK[D1].BTRUELIST := STK[D2].BTRUELIST;
STK[D1].BFALSELIST := STK[D2].BFALSELIST;
STK[D1].BFALLTHRUSKIPLOC := STK[D2].BFALLTHRUSKIPLOC;
STK[D1].BJUMPON := STK[D2].BJUMPON;
end
else if D2TYP =TYPS then
begin
STK[D1].SCNST := STK[D2].SCNST ;
STK[D1].SETPARTS := STK[D2].SETPARTS;
end
else if D2TYP = TYPR then
STK[D1].RCNST := STK[D2].RCNST;
STK[D1].ADDRORVAL := STK[D2].ADDRORVAL;
end (*DUPLICATE*);
UDUP :
begin
if TOP < BOT then ERROR(WDUP_ON_EMPTY_STACK);
if TYP <> STK[TOP].DTYPE THEN ERROR (WINSTR_TYPE_NOT_DATUM_TYPE);
if STK[TOP].BTRUELIST.FIRST <> nil then ASSERTFAIL ('TLIST_NOTNIL');
if STK[TOP].BFALSELIST.FIRST <> nil then ASSERTFAIL ('FLIST_NOTNIL');
if STK[TOP].BFALLTHRUSKIPLOC <> nil then ASSERTFAIL ('FALLT_NOTNIL');
PUSHTOP; ZERO_DATUM(TOP);
DUPLICATE(TOP, TOP-1, TYP);
end(*UDUP*);
USWP :
begin
if TOP <= BOT then ERROR(WSWP_NOT_2);
if ((STK[TOP].DTYPE <> TYP) or (STK[TOP-1].DTYPE <> TYP2)) then
ERROR(USWP_TYP_ERROR);
DUPLICATE(TMPD1, TOP, TYP);
DUPLICATE(TOP, TOP-1), TYPO2);
DUPLICATE(TOP-1, TMPD1, TYP);
end(*USWP*);
WSWP_NOT_2,
WSWP_NOT_2 :
begin
WRITELN(OUTPUT,'SWP with less than 2 DATUMs on STACK')
end;